package vns.client.helper;

import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.user.client.ui.TextBox;

public class NumericTextBox extends TextBox{
	public NumericTextBox(){
		this.addKeyPressHandler(new KeyPressHandler() {
			
			@Override
			public void onKeyPress(KeyPressEvent event) {
				masked(event.getCharCode());
			}
		});
	}
	private void masked(char keyCode){
		 if (!Character.isDigit(keyCode))
	          this.cancelKey();
	}
}
